<?php
// $Id: myalbum_287.php 227 2008-03-03 13:22:47Z mikhail.miguel $

// 2007-08-01 K.OHWADA
// module duplication

// 2007-06-10 K.OHWADA
// $opts['dirname']

// 2007-04-08 K.OHWADA
// sub category

//=========================================================
// WebLinks Module
// for myalbum 2.87 <http://xoops.peak.ne.jp/>
// 2007-03-25 K.OHWADA
//=========================================================

// --- functions begin ---
if( !function_exists( 'weblinks_plugin_albums_myalbum_287' ) ) 
{

function &weblinks_plugin_albums_myalbum_287( $opts )
{
	global $xoopsDB;

	$DIRNAME = isset( $opts['dirname'] ) ? $opts['dirname'] : 'myalbum';
	include XOOPS_ROOT_PATH."/modules/".$DIRNAME."/include/read_configs.php" ;

	$arr = array();

	$sql = "SELECT * FROM " . $table_cat . " ORDER BY cid";
	$res = $xoopsDB->query( $sql );

	while ( $row = $xoopsDB->fetchArray($res) )
	{
		$arr[ $row['cid'] ] = $row['title'];
	}

	return $arr;
}

function &weblinks_plugin_photos_myalbum_287( $opts )
{
	$DIRNAME = isset( $opts['dirname'] ) ? $opts['dirname'] : 'myalbum';
	include XOOPS_ROOT_PATH."/modules/".$DIRNAME."/blocks/myalbum_rphoto.php" ;

	$width       = isset( $opts['width'] )        ? intval( $opts['width'] )        : 140;
	$album_limit = isset( $opts['album_limit'] )  ? intval( $opts['album_limit'] )  : 1;
	$album_id    = isset( $opts['album_id'] )     ? intval( $opts['album_id'] )     : 0;
	$mode_sub    = isset( $opts['mode_sub'] )     ? intval( $opts['mode_sub'] )     : 1;
	$cycle       = isset( $opts['cycle'] )        ? intval( $opts['cycle'] )        : 60;
	$cols        = isset( $opts['cols'] )         ? intval( $opts['cols'] )         : 3;

	if ($album_id == 0)
	{
		$false = false;
		return $false;
	}
	elseif ($album_id == WEBLINKS_PLUGIN_ALL)
	{
		$album_id = 0;	// all category
	}

	$options = array(
		0 => $DIRNAME,		// dirname
		1 => $width,		// box_size
		2 => $album_limit,	// photos_num
		3 => $album_id,		// category
		4 => $mode_sub,		// sub category
	    5 => $cycle,		// cycle (sec)
		6 => $cols,			// cols
	);

	$arr = b_myalbum_rphoto_show( $options );

	return $arr;
}

}
// --- functions end ---

?>